package com.springboot.shiyan2;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

@SuppressWarnings("unused")
class CustomCommandLineRunner implements CommandLineRunner {

    Environment environment;

    public CustomCommandLineRunner(Environment environment){
        this.environment = environment;
    }

    @Override
    public void run(String... args){
        System.out.println("CommandLineRunner!");
        System.out.println("生成一个随机字符串：".concat(Objects.requireNonNull(environment.getProperty("random."))));
    }
}